package com.jilian.mydemo.modul.order.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jilian.mydemo.MyApplication;
import com.jilian.mydemo.R;
import com.jilian.mydemo.base.BaseActivity;

/**
 * 支付成功
 */
public class PaySuccessActivity extends BaseActivity {
    private TextView tvType;
    private TextView tvMoney;
    private TextView tvOk;


    @Override
    protected void createViewModel() {

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MyApplication.addActivity(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        MyApplication.removeActivity(this);
    }

    @Override
    public int intiLayout() {
        return R.layout.activity_paysuccess;
    }

    @Override
    public void initView() {
        setNormalTitle("支付成功", v -> finish());
        ImageView imageView = (ImageView) findViewById(R.id.iv_left_text);
        imageView.setVisibility(View.GONE);
        setrightTitle("报单", "#FFFFFF", new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(PaySuccessActivity.this, HydraulicDeclarationActivity.class);
                intent.putExtra("orderId", getIntent().getStringExtra("orderId"));
                intent.putExtra("orderDto", getIntent().getSerializableExtra("orderDto"));
                startActivity(intent);
                finish();
            }
        });
        tvType = (TextView) findViewById(R.id.tv_type);
        tvMoney = (TextView) findViewById(R.id.tv_money);
        tvOk = (TextView) findViewById(R.id.tv_ok);
        tvMoney.setText(getIntent().getStringExtra("totalMoney"));
        if ("1".equals(getIntent().getStringExtra("type"))) {
            tvType.setText("支付宝支付");
        }
        if ("2".equals(getIntent().getStringExtra("type"))) {
            tvType.setText("微信支付");
        }
        if ("3".equals(getIntent().getStringExtra("type"))) {
            tvType.setText("现金支付");
        }
    }

    @Override
    public void initData() {

    }

    @Override
    public void initListener() {
        tvOk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }
}
